package com.ym9527.utils;


import lombok.Data;

@Data
public class R {

    int code;

    String message;

    Boolean status;

    Object data;

    public static R error(){

        R respBean=new R();
        respBean.setMessage("失败!");
        respBean.setStatus(false);
        return respBean;
    }

    public static R error(String message){

        R respBean=new R();
        respBean.setMessage(message);
        respBean.setStatus(false);
        return respBean;
    }

    public static R error(int code, String message){
        R respBean=new R();
        respBean.setMessage(message);
        respBean.setCode(code);
        respBean.setStatus(false);
        return respBean;
    }

    public static R ok(Object o){

        R respBean=new R();
        respBean.setData(o);
        respBean.setMessage("成功!");
        respBean.setStatus(true);
        return respBean;
    }


    public static R ok(String message){

        R respBean=new R();
        respBean.setMessage(message);
        respBean.setStatus(true);
        return respBean;
    }

    public static R ok(int code, String message){
        return new R();
    }


    public static R ok(){
        R respBean=new R();
        respBean.setMessage("成功!");
        respBean.setStatus(true);
        return respBean;
    }



}
